package com.leo.biz.service.datakeep;

import com.leo.biz.po.DailyKRecord;
import com.leo.biz.po.StockBasicInfo;
import com.leo.biz.service.pub.DaoCenter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by leo on 2016/8/6.
 */
@Service
public class DataCommKeeper {
    @Autowired
    private DaoCenter daoCenter;

    public void deleteUseLessData(){
         String str="SELECT * FROM (SELECT COUNT(*) AS num,stockno FROM daily_k_record GROUP BY stockno) A WHERE A.num<100";
        List<Map<String,Object>> ret=daoCenter.getSqlQueryResult(str);
        for(int i=0;i<ret.size();i++)
        {
            daoCenter.delteResult(DailyKRecord.class," where stockno='"+ret.get(i).get("stockno")+"'");
            daoCenter.delteResult(StockBasicInfo.class," where stockno='"+ret.get(i).get("stockno")+"'");
            daoCenter.delteResult(DailyKRecord.class," where stockno like '3%'");
            daoCenter.delteResult(StockBasicInfo.class," where stockno like '3%'");
        }
    }
}
